<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-3.6.0.min.js"></script>
</head>
<body>
    <script>
         function jisuan(){
        var first = parseInt($("#first").val());
        var fu = $("#fu").val();
        var second= parseInt($("#second").val());
        var result = parseInt($("#result").val());
			switch (fu) {
				case '+':
					result = first + second;
					break;
				case '-':
				    result = first - second;
				    break;
				case '*':
				    result = first * second;
				    break;
				case '/':
				    if(second != 0){
				    	result = first / second;
				    }
				    else{
				    	alert('被除数不能为0');
				    }
				    break;
				default:
					alert('运算符错误！')
					break;
			}
            var row =  `<tr>
        <td>${result}</td></tr>`
    $("tbody").append(row);
        }
        
    </script>
   
    <input type="text" id="first"><br>
	<input type="text" id="fu" style="width: 20px"><br>
	<input type="text" id="second"><br>
	=<br>
    <table>
        <tbody>

        </tbody>
    </table>
	
    <button onclick="jisuan()">计算</button>
</body>
</html>